package com.atguigu.jxc.controller;

import com.atguigu.jxc.entity.Unit;
import com.atguigu.jxc.service.UnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author ONIE
 * @create 2021/11/25 8:45 下午
 */
@RestController
@RequestMapping("unit")
public class UnitController {

	@Autowired
	private UnitService unitService;

	/**
	 * 查询所有商品单位
	 * @return
	 */
	@PostMapping("list")
	public Map<String, Object> unitList(){
		List<Unit> unitList= unitService.unitList();
		Map<String, Object> map = new HashMap<>();
		map.put("rows",unitList);
		return map;
	}
}
